package com.trace.pplos.parse.dao.dataobject;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

public class YjldInfo {
    private static final Logger logger = LoggerFactory.getLogger(WpxxInfo.class);

    private Integer id;

    private String billNo;

    private String bldType;

    private String name;

    private String lng;

    private String lat;

    private String addr;

    private String drplt;

    private String telI;

    private String telIi;

    private String telIii;

    private String des;

    private String photoPath;

    private String synced;

    private String lngGps;

    private String latGps;

    private String facadePhotoPath;

    private String wholePhotoPath;

    private String leftPhotoPath;

    private String rightPhotoPath;

    private String licensePhotoPath;

    private String otherPhotoPath;

    private String videoPath;

    private String videoDisplayNames;

    private String signalStation;

    private String cjdw;

    private String filepath;

    private Date gmtCreate;

    private String gmtCreateUser;

    private Date gmtModified;

    private String gmtModifiedUser;

    private Integer status;

    public YjldInfo(Integer id, String billNo, String bldType, String name, String lng, String lat, String addr, String drplt, String telI, String telIi, String telIii, String des, String photoPath, String synced, String lngGps, String latGps, String facadePhotoPath, String wholePhotoPath, String leftPhotoPath, String rightPhotoPath, String licensePhotoPath, String otherPhotoPath, String videoPath, String videoDisplayNames, String signalStation, String cjdw, String filepath, Date gmtCreate, String gmtCreateUser, Date gmtModified, String gmtModifiedUser, Integer status) {
        this.id = id;
        this.billNo = billNo;
        this.bldType = bldType;
        this.name = name;
        this.lng = lng;
        this.lat = lat;
        this.addr = addr;
        this.drplt = drplt;
        this.telI = telI;
        this.telIi = telIi;
        this.telIii = telIii;
        this.des = des;
        this.photoPath = photoPath;
        this.synced = synced;
        this.lngGps = lngGps;
        this.latGps = latGps;
        this.facadePhotoPath = facadePhotoPath;
        this.wholePhotoPath = wholePhotoPath;
        this.leftPhotoPath = leftPhotoPath;
        this.rightPhotoPath = rightPhotoPath;
        this.licensePhotoPath = licensePhotoPath;
        this.otherPhotoPath = otherPhotoPath;
        this.videoPath = videoPath;
        this.videoDisplayNames = videoDisplayNames;
        this.signalStation = signalStation;
        this.cjdw = cjdw;
        this.filepath = filepath;
        this.gmtCreate = gmtCreate;
        this.gmtCreateUser = gmtCreateUser;
        this.gmtModified = gmtModified;
        this.gmtModifiedUser = gmtModifiedUser;
        this.status = status;
    }

    public YjldInfo() {
        super();
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getBillNo() {
        return billNo;
    }

    public void setBillNo(String billNo) {
        this.billNo = billNo == null ? null : billNo.trim();
    }

    public String getBldType() {
        return bldType;
    }

    public void setBldType(String bldType) {
        this.bldType = bldType == null ? null : bldType.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getLng() {
        return lng;
    }

    public void setLng(String lng) {
        this.lng = lng == null ? null : lng.trim();
    }

    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat == null ? null : lat.trim();
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr == null ? null : addr.trim();
    }

    public String getDrplt() {
        return drplt;
    }

    public void setDrplt(String drplt) {
        this.drplt = drplt == null ? null : drplt.trim();
    }

    public String getTelI() {
        return telI;
    }

    public void setTelI(String telI) {
        this.telI = telI == null ? null : telI.trim();
    }

    public String getTelIi() {
        return telIi;
    }

    public void setTelIi(String telIi) {
        this.telIi = telIi == null ? null : telIi.trim();
    }

    public String getTelIii() {
        return telIii;
    }

    public void setTelIii(String telIii) {
        this.telIii = telIii == null ? null : telIii.trim();
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des == null ? null : des.trim();
    }

    public String getPhotoPath() {
        return photoPath;
    }

    public void setPhotoPath(String photoPath) {
        this.photoPath = photoPath == null ? null : photoPath.trim();
    }

    public String getSynced() {
        return synced;
    }

    public void setSynced(String synced) {
        this.synced = synced == null ? null : synced.trim();
    }

    public String getLngGps() {
        return lngGps;
    }

    public void setLngGps(String lngGps) {
        this.lngGps = lngGps == null ? null : lngGps.trim();
    }

    public String getLatGps() {
        return latGps;
    }

    public void setLatGps(String latGps) {
        this.latGps = latGps == null ? null : latGps.trim();
    }

    public String getFacadePhotoPath() {
        return facadePhotoPath;
    }

    public void setFacadePhotoPath(String facadePhotoPath) {
        this.facadePhotoPath = facadePhotoPath == null ? null : facadePhotoPath.trim();
    }

    public String getWholePhotoPath() {
        return wholePhotoPath;
    }

    public void setWholePhotoPath(String wholePhotoPath) {
        this.wholePhotoPath = wholePhotoPath == null ? null : wholePhotoPath.trim();
    }

    public String getLeftPhotoPath() {
        return leftPhotoPath;
    }

    public void setLeftPhotoPath(String leftPhotoPath) {
        this.leftPhotoPath = leftPhotoPath == null ? null : leftPhotoPath.trim();
    }

    public String getRightPhotoPath() {
        return rightPhotoPath;
    }

    public void setRightPhotoPath(String rightPhotoPath) {
        this.rightPhotoPath = rightPhotoPath == null ? null : rightPhotoPath.trim();
    }

    public String getLicensePhotoPath() {
        return licensePhotoPath;
    }

    public void setLicensePhotoPath(String licensePhotoPath) {
        this.licensePhotoPath = licensePhotoPath == null ? null : licensePhotoPath.trim();
    }

    public String getOtherPhotoPath() {
        return otherPhotoPath;
    }

    public void setOtherPhotoPath(String otherPhotoPath) {
        this.otherPhotoPath = otherPhotoPath == null ? null : otherPhotoPath.trim();
    }

    public String getVideoPath() {
        return videoPath;
    }

    public void setVideoPath(String videoPath) {
        this.videoPath = videoPath == null ? null : videoPath.trim();
    }

    public String getVideoDisplayNames() {
        return videoDisplayNames;
    }

    public void setVideoDisplayNames(String videoDisplayNames) {
        this.videoDisplayNames = videoDisplayNames == null ? null : videoDisplayNames.trim();
    }

    public String getSignalStation() {
        return signalStation;
    }

    public void setSignalStation(String signalStation) {
        this.signalStation = signalStation == null ? null : signalStation.trim();
    }

    public String getCjdw() {
        return cjdw;
    }

    public void setCjdw(String cjdw) {
        this.cjdw = cjdw == null ? null : cjdw.trim();
    }

    public String getFilepath() {
        return filepath;
    }

    public void setFilepath(String filepath) {
        this.filepath = filepath == null ? null : filepath.trim();
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public String getGmtCreateUser() {
        return gmtCreateUser;
    }

    public void setGmtCreateUser(String gmtCreateUser) {
        this.gmtCreateUser = gmtCreateUser == null ? null : gmtCreateUser.trim();
    }

    public Date getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(Date gmtModified) {
        this.gmtModified = gmtModified;
    }

    public String getGmtModifiedUser() {
        return gmtModifiedUser;
    }

    public void setGmtModifiedUser(String gmtModifiedUser) {
        this.gmtModifiedUser = gmtModifiedUser == null ? null : gmtModifiedUser.trim();
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public static YjldInfo toBean(String object) {
        try {
            YjldInfo info = new YjldInfo();
            JSONObject record = JSON.parseObject(object);
         /*   info.setId(Integer.parseInt(record.getString("id")));*/
          /*  info.setBillNo(record.getString());*/
            info.setSynced("0");
            info.setBldType(record.getString("dmlx"));
            info.setName(record.getString("dmmc"));
            info.setLng(record.getString("longitude"));
            info.setLat(record.getString("latitude"));
            info.setAddr(record.getString("address"));
            info.setDrplt(record.getString("mphm"));
            info.setTelI(record.getString("dhhm"));
            info.setTelIi(record.getString("dhhm"));
            info.setTelIii(record.getString("dhhm"));
            info.setDes(record.getString("bzxx"));
            //其他照片
            String photoPath = "";
            JSONArray photoPathlist = record.getJSONArray("qtPictureList");
            for (int i = 0; i < photoPathlist.size(); i++) {
                JSONObject dataObj = photoPathlist.getJSONObject(i);
                photoPath += dataObj.getString("path") + ",";
            }
            info.setPhotoPath(photoPath);
            info.setSynced("1");
            info.setLngGps(record.getString("longitude"));
            info.setLatGps(record.getString("latitude"));
            //正面照片
            String facadePhotoPath = "";
            JSONArray facadePhotoPathhlist = record.getJSONArray("zmPictureList");
            for (int i = 0; i < facadePhotoPathhlist.size(); i++) {
                JSONObject dataObj = facadePhotoPathhlist.getJSONObject(i);
                facadePhotoPath += dataObj.getString("path") + ",";
            }
            info.setFacadePhotoPath(facadePhotoPath);
            //整体照片
            String wholePhotoPath = "";
            JSONArray wholePhotoPathlist = record.getJSONArray("ztPictureList");
            for (int i = 0; i < wholePhotoPathlist.size(); i++) {
                JSONObject dataObj = wholePhotoPathlist.getJSONObject(i);
                wholePhotoPath += dataObj.getString("path") + ",";
            }
            info.setWholePhotoPath(wholePhotoPath);

            //左面照片
            String leftPhotoPath = "";
            JSONArray leftPhotoPathlist = record.getJSONArray("zlPictureList");
            for (int i = 0; i < leftPhotoPathlist.size(); i++) {
                JSONObject dataObj = leftPhotoPathlist.getJSONObject(i);
                leftPhotoPath += dataObj.getString("path") + ",";
            }
            info.setLeftPhotoPath(leftPhotoPath);

            //右面照片
            String rightPhotoPath = "";
            JSONArray rightPhotoPathlist = record.getJSONArray("ylPictureList");
            for (int i = 0; i < rightPhotoPathlist.size(); i++) {
                JSONObject dataObj = rightPhotoPathlist.getJSONObject(i);
                rightPhotoPath += dataObj.getString("path") + ",";
            }
            info.setRightPhotoPath(rightPhotoPath);
            //营业执照
            String licensePhotoPath = "";
            JSONArray licensePhotoPathlist = record.getJSONArray("yyzzPictureList");
            for (int i = 0; i < licensePhotoPathlist.size(); i++) {
                JSONObject dataObj = licensePhotoPathlist.getJSONObject(i);
                licensePhotoPath += dataObj.getString("path") + ",";
            }
            info.setLicensePhotoPath(licensePhotoPath);
            //相邻场所照片
            String otherPhotoPath = "";
            JSONArray otherPhotoPathlist = record.getJSONArray("ylPictureList");
            for (int i = 0; i < otherPhotoPathlist.size(); i++) {
                JSONObject dataObj = otherPhotoPathlist.getJSONObject(i);
                licensePhotoPath += dataObj.getString("path") + ",";
            }
            info.setOtherPhotoPath(otherPhotoPath);

         /*   info.setVideoPath(record.getString());
            info.setVideoDisplayNames(record.getString());
            info.setSignalStation(record.getString());
            info.setCjdw(record.getString());
            info.setFilepath(record.getString());*/
            info.setGmtCreate(record.getDate("createdAt"));
            info.setGmtCreateUser(record.getString("createdBy"));
            //info.setGmtModified(record.getDate("modifiedAt"));
            info.setGmtModified(new Date());
            info.setGmtModifiedUser(record.getString("modifiedBy"));
            return info;
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
        return null;
    }
}